<!-- templates/schedule_stats_modal.html -->

<!-- 统计排课 Modal -->
<div class="modal fade" id="statsModal" tabindex="-1" aria-hidden="true">
  <div class="modal-dialog modal-md modal-dialog-centered">
    <div class="modal-content">
      <!-- Modal 头部 -->
      <div class="modal-header">
        <h5 class="modal-title">
          <i class="bi bi-bar-chart-line me-2"></i>排课统计
        </h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
      </div>
      <!-- Modal 主体 -->
      <div class="modal-body">
        <!-- 条件面板 -->
        <div id="stats-panel">
          <!-- 开始日期 -->
          <div class="start-date-container col-auto">
            <label for="stats-start-date">开始日期</label>
            <input type="date" id="stats-start-date" class="form-control form-control-sm">
          </div>
          <!-- 结束日期 -->
          <div class="end-date-container col-auto">
            <label for="stats-end-date">结束日期</label>
            <input type="date" id="stats-end-date" class="form-control form-control-sm">
          </div>
          <!-- 关键字 -->
          <div class="keyword-container col-12">
            <label for="stats-keywords">关键字</label>
            <input type="text" id="stats-keywords" class="form-control form-control-sm" placeholder="空格分隔">
          </div>
          <!-- 排课状态 -->
          <div class="status-container col-12">
            <label for="stats-status">状态</label>
            <select id="stats-status" class="form-select form-select-sm">
              <option value="all" selected>全部</option>
              <option value="已上">已上</option>
              <option value="未上">未上</option>
            </select>
          </div>
        </div>

        <!-- 统计条件说明（统计后显示） -->
        <div id="stats-summary"></div>

        <!-- 结果表格 -->
        <div id="stats-results">
          <table class="table table-sm text-center mb-0">
            <thead>
              <tr>
                <th>学生姓名</th>
                <th>排课数量</th>
                <th>课时费总额</th>
              </tr>
            </thead>
            <tbody id="stats-body">
              <!-- 动态渲染统计行 & 合计行 -->
            </tbody>
          </table>
        </div>
      </div>
      <!-- Modal 底部 -->
      <div class="modal-footer">
        <button id="do-stats" class="btn btn-primary btn-sm me-auto">统计</button>
        <button type="button" class="btn btn-secondary btn-sm" data-bs-dismiss="modal">关闭</button>
      </div>
    </div>
  </div>
</div>
